import axios from 'axios';
import type { RouteRecordNormalized } from 'vue-router';
import { UserState } from '@/store/modules/user/types';
import http from '.'

export interface LoginData {
  userAccount: string;
  userPassword: string;
}

export interface LoginRes {
  token: string | null;
}
// 登录
export function login(data: LoginData) {
  return http.post<any>('/user/login', { data });
}

export function logout() {
  return http.post<any>('/api/user/logout');
}

// 获取用户信息
export function getUserInfo(token:LoginRes) {
  // return http.post<any>(`/user/getUserByToken/${token}`);
  return http.get<any>('/user/getUserByToken/{token}');
}

export function getMenuList() {
  return http.post<any>('/api/user/menu');
}
